custom_imports=dict(
    imports=['mmaction.models.backbones.c3d_pool'])
model = dict(
    type='Recognizer3D',
    backbone=dict(
        type='C3DPool',
        pretrained=  # noqa: E251
        'https://download.openmmlab.com/mmaction/recognition/c3d/c3d_sports1m_pretrain_20201016-dcc47ddc.pth',  # noqa: E501
        style='pytorch',
        conv_cfg=dict(type='Conv3d'),
        norm_cfg=None,
        act_cfg=dict(type='ReLU'),
        dropout_ratio=0.5,
        init_std=0.005),
    cls_head=dict(
        type='I3DHead',
        num_classes=2,
        in_channels=256,
        spatial_type=None,
        dropout_ratio=0.5,
        init_std=0.01),
    # model training and testing settings
    train_cfg=None,
    test_cfg=dict(average_clips='score'))

# dataset settings
dataset_type = 'VideoDataset'
data_root = '/media/wsl/a9f0161f-7971-c843-8c81-c68049a0235a/DataSet/芜湖海螺/水泥船/smoke/'
ann_file_train = '/media/wsl/a9f0161f-7971-c843-8c81-c68049a0235a/DataSet/芜湖海螺/水泥船/smoke/train.txt'
val_file_train = '/media/wsl/a9f0161f-7971-c843-8c81-c68049a0235a/DataSet/芜湖海螺/水泥船/smoke/train_ok.txt'

transforms=[dict(type='Crop', percent=([0.1, 0.2], [0.00, 0.01], [0.0, 0.01], [0.0, 0.2]), keep_size=False),
            dict(type='MultiplyAndAddToBrightness',mul=(0.6, 1.5), add=(-30, 30)),
            dict(type='Affine',scale=(0.9, 1.0), rotate=(-60,60),translate_percent=(-0.2,0.2), fit_output=True),
            ]

img_norm_cfg = dict(mean=[104, 117, 128], std=[1, 1, 1], to_bgr=False)
train_pipeline = [
    dict(type='DecordInit'),
    dict(type='SampleFrames', clip_len=16, frame_interval=25, num_clips=1),
    dict(type='DecordDecode'),
    dict(type='Imgaug', transforms=transforms),
    dict(type='Resize', scale=(256,256),keep_ratio=False),
    dict(type='Flip', flip_ratio=0.5),
    dict(type='Normalize', **img_norm_cfg),
    dict(type='FormatShape', input_format='NCTHW'),
    dict(type='Collect', keys=['imgs', 'label'], meta_keys=[]),
    dict(type='ToTensor', keys=['imgs', 'label'])
]
val_pipeline = [
    dict(type='DecordInit'),
    dict(type='SampleFrames', clip_len=16, frame_interval=25, num_clips=1),
    dict(type='DecordDecode'),
    #dict(type='Imgaug', transforms=transforms),
    dict(type='Resize', scale=(256,256),keep_ratio=False),
    dict(type='Normalize', **img_norm_cfg),
    dict(type='FormatShape', input_format='NCTHW'),
    dict(type='Collect', keys=['imgs', 'label'], meta_keys=[]),
    dict(type='ToTensor', keys=['imgs', 'label'])
]
test_pipeline = [
    dict(type='DecordInit'),
    dict(type='SampleFrames', clip_len=16, frame_interval=25, num_clips=1),
    dict(type='DecordDecode'),
    dict(type='Resize', scale=(256,256)),
    dict(type='Normalize', **img_norm_cfg),
    dict(type='FormatShape', input_format='NCTHW'),
    dict(type='Collect', keys=['imgs', 'label'], meta_keys=[]),
    dict(type='ToTensor', keys=['imgs', 'label'])
]
data = dict(
    videos_per_gpu=4,
    workers_per_gpu=2,
    test_dataloader=dict(videos_per_gpu=1),
    train=dict(
        type=dataset_type,
        ann_file=ann_file_train,
        data_prefix=data_root,
        pipeline=train_pipeline),
    val=dict(
        type=dataset_type,
        ann_file=val_file_train,
        data_prefix=data_root,
        pipeline=val_pipeline),
    test=dict(
        type=dataset_type,
        ann_file=val_file_train,
        data_prefix=data_root,
        pipeline=test_pipeline))
# optimizer
optimizer = dict(
    type='Adam', lr=0.001, weight_decay=0.00001)
optimizer_config = dict(grad_clip=dict(max_norm=40, norm_type=2))
# learning policy
lr_config = dict(policy='step', step=[20, 40])
total_epochs = 45
checkpoint_config = dict(interval=5)
evaluation = dict(
    interval=5, metrics=['top_k_accuracy', 'mean_class_accuracy'])
log_config = dict(
    interval=10,
    hooks=[
        dict(type='TextLoggerHook'),
        # dict(type='TensorboardLoggerHook'),
    ])
# runtime settings
dist_params = dict(backend='nccl')
log_level = 'INFO'
work_dir = f'./work_dirs/c3d_sports1m_16x1x1_45e_boat'
load_from = None
resume_from = None
workflow = [('train', 1)]
#fp16=dict(loss_scale='dynamic')
